using System;
using System.Collections.Generic;
using IFXplus.Northwind;
using IFXplus.SmartStorage;

namespace IFXplus.Northwind
{
    public class CustomerListCache : BaseStorageManager<List<Customer>>
    {
        public static StorageItemMetadata GetMetadata()
        {
            StorageItemMetadata metadata = new StorageItemMetadata();

            metadata.BaseKey = "IFXplus.Northwind.CustomerList";

            metadata.AbsoluteTTL = new TimeSpan(0, 0, 30, 0, 0);

            //metadata.AddProvider("ASPNET", StorageProviderType.AspNetCache);
            //metadata.AddProvider("FS", StorageProviderType.FileSystem);
            metadata.AddProvider("MEM", StorageProviderType.Memory);

            return metadata;
        }

        public static List<Customer> Get()
        {
            return Get(GetMetadata());
        }

        public static void Insert(List<Customer> value)
        {
            Insert(GetMetadata(), value);
        }

        public static void Remove()
        {
            Remove(GetMetadata());
        }
    }
}